arrs = []
result = 0

def dfs(n, depth, maxDepth):
    global result
    if depth == maxDepth:
        for item in arrs:
            print(item, end=" ")
        print(n)
        result += 1
        return
    for i in range(1, n - maxDepth + depth + 1):
        arrs.append(i)
        dfs(n - i, depth + 1, maxDepth)
        arrs.pop() 

dfs(7, 1, 3)
print(result)
